Skip to content

Extract shared core infrastructure from Power and Fluid systems#10

Merged
CoderJoeW merged 7 commits intomainfrom
refactor/core-extraction
Mar 6, 2026
Merged

Extract shared core infrastructure from Power and Fluid systems#10
CoderJoeW merged 7 commits intomainfrom
refactor/core-extraction

Conversation

@CoderJoeW
Copy link
Copy Markdown
Owner

Summary

  • Extract shared base class (AtlasBlock), generic BlockRegistry, BlockFactory, BlockPersistence, and BlockDescriptor into a core package, eliminating ~800 lines of duplicated infrastructure between the Power and Fluid systems
  • Replace PowerBlockListener and FluidBlockListener with a single descriptor-driven AtlasBlockListener that handles all block systems generically via BlockSystem
  • Consolidate dialog refresh loop into AtlasBlockDialog, with domain dialogs as thin rendering wrappers
  • Auto-discover textures by scanning the JAR/classpath instead of maintaining a 90-entry hardcoded list
  • Replace PowerBlockInitializer and FluidBlockInitializer with declarative descriptor-driven registration via BlockFactory.registerFromDescriptors()

Adding a new block type now requires only: creating the block class with a descriptor companion, adding it to the system's descriptor list, and dropping texture files. Adding a new system requires only: a domain block class, a thin dialog wrapper, and a BlockSystem registration in Atlas.kt.

…tor into core package

PowerBlock and FluidBlock now extend AtlasBlock, which owns the shared
start/stop/updateVisualState lifecycle. PowerBlockRegistry and
FluidBlockRegistry extend the generic BlockRegistry. Each concrete block
class gains a companion BlockDescriptor with self-describing metadata and
overrides for facing/baseBlockId properties.
…idBlockFactory

Both factories now extend BlockFactory<T>, which owns the registration map
and create/isRegistered/getRegisteredBlockIds/clear methods. Domain factories
retain their convenience delegate methods (createPowerBlock, createFluidBlock).
…data classes

BlockPersistence<T> handles common location/world/facing serialization.
PowerBlockPersistence and FluidBlockPersistence are now thin wrappers
providing serialize/restore lambdas for domain-specific fields. Data
classes use block.facing property instead of when chains.
…ied AtlasBlockListener

Add BlockSystem to bundle registry, factory, descriptors, and dialog handler per system.
AtlasBlockListener iterates systems generically for placement, break, and interact events.
Delete PowerBlockListener and FluidBlockListener. Update Atlas.kt to register a single
unified listener. Rewrite listener tests to target AtlasBlockListener.
Move activeDialogs management, proximity/online/registry checks, and
refresh task scheduling into core AtlasBlockDialog. PowerBlockDialog and
FluidBlockDialog become thin rendering wrappers that delegate to
AtlasBlockDialog.showDialog with domain-specific render lambdas.
…ed list

Replace the 90-entry hardcoded texture list in NexoIntegration with
classpath scanning via discoverResources(). Supports both JAR (production)
and file (test/dev) protocols. Adding new textures now requires zero code
changes — just drop the .png file into the resources directory.
Add BlockFactory.registerFromDescriptors() to register all block IDs
from BlockDescriptor metadata. Delete PowerBlockInitializer and
FluidBlockInitializer. Atlas.kt now derives registrations from the
same descriptor lists used by BlockSystem. Update all tests to use
TestHelper.initPowerFactory() / initFluidFactory() helpers.
@CoderJoeW CoderJoeW merged commit 6cafa21 into main Mar 6, 2026
1 check passed
@CoderJoeW CoderJoeW deleted the refactor/core-extraction branch March 15, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant